#ifndef _WINSOCK2CLIENTSOCKET_H
#define _WINSOCK2CLIENTSOCKET_H

#pragma once
#include "ClientSocket.h"
#include "NetworkException.h"
#include <winsock2.h>
#include <ws2tcpip.h>
#include <string>
#include <iostream>
#include <sstream>

using namespace std;

namespace net
{
class Winsock2ClientSocket : public ClientSocket
{
public:
	virtual ~Winsock2ClientSocket(void);
	virtual void doConnect(void) throw (NetworkException);
	virtual int doSend(const char*);
	virtual int doSendComplete(const char* sendbuf);
	virtual int doReceive(char*, int);
	virtual int doReceiveComplete(char* recvbuf);
	virtual void doShutdown(void);
	virtual void doClose(void);
	virtual string toString(void);
	friend class Winsock2SocketFactory;
private:
	Winsock2ClientSocket(string, string);
	struct addrinfo* obtainedAddress;
	struct addrinfo requestedAddress;
	SOCKET socketConnection;
	static int WSA_VERSION;
	static int WSA_REVISION;
};
};

#endif
